﻿<UserControl x:Class="TimeSplicerModule.Views.TaskListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             Width="1100" Height="Auto">
    
    <Grid VerticalAlignment="Top" HorizontalAlignment="Left" Margin="35,0,35,0">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="60" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <Border Grid.Column="0" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Left">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="User:" Margin="25,0,0,0" Height="25" />
                    <ComboBox Name="usersComboBox" Margin="15,0,0,0" ItemsSource="{Binding Path=Users}"
                                          Width="150"
                                          DisplayMemberPath="FullName"
                                          SelectedValuePath="UserGuid"
                                          SelectedValue="{Binding Path=SelectedUserGuid, UpdateSourceTrigger=PropertyChanged}"
                                          SelectionChanged="ComboBox_SelectionChanged">
                    </ComboBox>

                    <TextBlock Text="Status:" Margin="25,0,0,0" Height="25" />
                    <ComboBox Name="taskStatusesComboBox" ItemsSource="{Binding Path=Statuses}" Margin="15,0,0,0"
                                          Width="150"
                                          DisplayMemberPath="Name"
                                          SelectedValuePath="StatusGuid"
                                          SelectedValue="{Binding Path=SelectedStatusGuid}"
                                          SelectionChanged="taskStatusesComboBox_SelectionChanged">

                    </ComboBox>

                    <TextBlock Text="Search:" Margin="25,0,0,0" Height="25" />
                    <TextBox Name="textSearchTextBox" Text="{Binding Path=SearchText, Mode=TwoWay}" Width="200" Margin="15,0,0,0" Height="25" TextChanged="TextBox_TextChanged" />
                </StackPanel>



            </Border>


            <Border Grid.Column="0" Grid.Row="1" Margin="5" VerticalAlignment="Top" HorizontalAlignment="Left">
                <ListView ItemsSource="{Binding Path=FilteredTasks}"
                             
                                      ItemTemplate="{StaticResource ResourceKey=TaskListItemTemplate}"
                                      SelectionChanged="ListView_SelectionChanged">
                    <ListView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <WrapPanel ItemWidth="400" ItemHeight="65" Width="800" />
                            <!--<WrapPanel Width="{Binding (FrameworkElement.ActualWidth), 
                                RelativeSource={RelativeSource AncestorType=ScrollContentPresenter}}"
                                ItemWidth="{Binding (ListView.View).ItemWidth, 
                                RelativeSource={RelativeSource AncestorType=ListView}}"
                                MinWidth="{Binding ItemWidth, RelativeSource={RelativeSource Self}}"
                                ItemHeight="{Binding (ListView.View).ItemHeight, 
                                RelativeSource={RelativeSource AncestorType=ListView}}" />-->
                        </ItemsPanelTemplate>
                    </ListView.ItemsPanel>

                    <!--<DataGrid.Columns>
                                    -->
                    <!--<DataGridTextColumn Header="Status" Binding="{Binding Path=Name}"/>
                                    <DataGridTextColumn Header="Description" Binding="{Binding Path=Description}"/>-->
                    <!--
                                </DataGrid.Columns>-->
                </ListView>
            </Border>

            <!-- Pregress Ring -->
            <Border Name="progressBorder" Grid.Column="0" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Panel.ZIndex="3">
                <controls:ProgressRing Name="progressRing" VerticalAlignment="Center" HorizontalAlignment="Center" />
            </Border>
        </Grid>
    </Grid>
</UserControl>
